
class ServerResponse<T>{
  bool type;
  int code;
  T msg;
  String memo;
  String url;
  String msgText;

  ServerResponse({
    this.type,this.code,this.msg,this.memo,this.url, this.msgText
  });

  factory ServerResponse.fromJson(Map<String,dynamic> json, T initializeMsgProperty(Object json)){
    var _type =json['type'] as bool;

    return ServerResponse(
      type: json['type'] ?? false,
      code: json['code'],
      msg:  !_type ? null : initializeMsgProperty(json["msg"]),
      memo: json['memo'],
      url: json['url'],
      msgText: _type ? "" : json["msg"],
    );
  }

  Map<String, dynamic> toJson() => {
    'type': type,
    'code': code,
    'msg': msg,
    'memo': memo,
    'url': url,
  };
}



//(C) 2018 Json to Dart, Hope you enjoy!
